package com.reader.cms.entity.sys;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.reader.core.validator.group.AddGroup;
import com.reader.core.validator.group.UpdateGroup;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author jiahaikun
 * @since 2018-06-29
 */
@TableName("sys_menu")
public class SysMenu extends Model<SysMenu> {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 父菜单ID
     */
    @TableField("parent_id")
    private Integer parentId;
    /**
     * 菜单名称
     */
    @NotBlank(message="菜单或目录名称不能为空！！！", groups = {AddGroup.class, UpdateGroup.class})
    private String name;
    /**
     * 菜单path
     */
    private String path;
    /**
     * 资源编码perm
     */
    private String perm;


    /**
     * 类型(0:目录,1:菜单)
     */
    private Integer type;
    /**
     * 菜单序号
     */
    @TableField("order_num")
    private Integer orderNum;
    private String icon;
    private Integer enable;
    @TableField("del_flag")
    private Integer delFlag;
    /**
     * 记录插入时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField("insert_dt")
    private Date insertDt;
    /**
     * 记录插入ID
     */
    @TableField("insert_user_id")
    private Integer insertUserId;
    /**
     * 记录修改日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField("updt_dt")
    private Date updtDt;
    /**
     * 记录修改ID
     */
    @TableField("updt_user_id")
    private Integer updtUserId;

    //子菜单
    @TableField(exist = false)
    private List<SysMenu> children;
    //组件
    @TableField(exist = false)
    private String component;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }


    public String getPerm() {
        return perm;
    }

    public void setPerm(String perm) {
        this.perm = perm;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer  getEnable() {
        return enable;
    }

    public void setEnable(Integer enable) {
        this.enable = enable;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }

    public Date getInsertDt() {
        return insertDt;
    }

    public void setInsertDt(Date insertDt) {
        this.insertDt = insertDt;
    }

    public Integer getInsertUserId() {
        return insertUserId;
    }

    public void setInsertUserId(Integer insertUserId) {
        this.insertUserId = insertUserId;
    }

    public Date getUpdtDt() {
        return updtDt;
    }

    public void setUpdtDt(Date updtDt) {
        this.updtDt = updtDt;
    }

    public Integer getUpdtUserId() {
        return updtUserId;
    }

    public void setUpdtUserId(Integer updtUserId) {
        this.updtUserId = updtUserId;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }


    public List<SysMenu> getChildren() {
        return children;
    }

    public void setChildren(List<SysMenu> children) {
        this.children = children;
    }


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "SysMenu{" +
        ", id=" + id +
        ", parentId=" + parentId +
        ", name=" + name +
        ", path=" + path +
        ", type=" + type +
        ", orderNum=" + orderNum +
        ", icon=" + icon +
        ", enable=" + enable +
        ", delFlag=" + delFlag +
        ", insertDt=" + insertDt +
        ", insertUserId=" + insertUserId +
        ", updtDt=" + updtDt +
        ", updtUserId=" + updtUserId +
        "}";
    }
}
